<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<a href="javascript:;" data-url="天下无贼" data-sort="free">天下无贼</a>
		<a href="javascript:;" data-url="复仇者联盟" data-sort="pay">复仇者联盟</a>
		<a href="javascript:;" data-url="普罗米修斯" data-sort="free">普罗米修斯</a>
		<a href="javascript:;" data-url="欧罗亚报告" data-sort="pay">欧罗亚报告</a>
	</body>

	<script type="text/javascript">
		var link = document.getElementsByTagName('a');
		
		for (var i = 0; i < link.length; i++){
			(function(j){
				link[j].onclick = function(){
					var url = this.dataset.url,
						sort = this.dataset.sort;
						
						if (sort === 'free'){
							window.open('https://baike.baidu.com/item/' + url);
						}else if(sort === 'pay'){
							alert('请充值会员');
						}
				}
			})(i);
		}
	</script>
</html>
